package response

import (
	"fmt"
	"github.com/gin-gonic/gin"
)

func Success(ctx *gin.Context, data ...interface{})  {
	m := gin.H{"success": true}
	if len(data) > 0 {
		m["data"] = data[0]
	}
	ctx.JSON(200, m)
}

func Error(ctx *gin.Context, msg interface{})  {
	ctx.JSON(200, gin.H{
		"success": false,
		"message": fmt.Sprintf("%v", msg),
	})
}
